﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace COre_WEB_Api.Controllers
{
    public class FirstController : Controller
    {
        private readonly ILogger<FirstController> _logger;
        private readonly ILoggerFactory _loggerFactory;

        public FirstController(ILogger<FirstController> logger,ILoggerFactory loggerFactory)
        {
            _logger = logger;
            _loggerFactory = loggerFactory;  
        }

        public IActionResult Index()
        {
            _logger.LogWarning("This is FirstController-Index");
            ViewBag.Name = "张三";
            ViewData["Name"] = "李四";
            TempData["Name"] = "王五";
            object name = "ivy";
            string result = HttpContext.Session.GetString("Name4");
            if (string.IsNullOrEmpty(result))
            {
                HttpContext.Session.SetString("User4", "一往情深");
            }
            return View(name);
            return View();
        }
    }
}
